package dto

import (

	"go-admin/app/xinghe/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
)

type PopulationGetPageReq struct {
	dto.Pagination     `search:"-"`
    Name string `form:"name"  search:"type:contains;column:name;table:population" comment:"姓名"`
    City string `form:"city"  search:"type:exact;column:city;table:population" comment:"城市"`
    Country string `form:"country"  search:"type:exact;column:country;table:population" comment:"国家"`
    Nationality string `form:"nationality"  search:"type:exact;column:nationality;table:population" comment:"国籍"`
    MaritalStatus string `form:"maritalStatus"  search:"type:exact;column:marital_status;table:population" comment:"婚姻状况"`
    EducationLevel string `form:"educationLevel"  search:"type:exact;column:education_level;table:population" comment:"教育水平"`
    PopulationOrder
}

type PopulationOrder struct {
    Id string `form:"idOrder"  search:"type:order;column:id;table:population"`
    CreateBy string `form:"createByOrder"  search:"type:order;column:create_by;table:population"`
    UpdateBy string `form:"updateByOrder"  search:"type:order;column:update_by;table:population"`
    CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:population"`
    UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:population"`
    DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:population"`
    Name string `form:"nameOrder"  search:"type:order;column:name;table:population"`
    Age string `form:"ageOrder"  search:"type:order;column:age;table:population"`
    Gender string `form:"genderOrder"  search:"type:order;column:gender;table:population"`
    Occupation string `form:"occupationOrder"  search:"type:order;column:occupation;table:population"`
    Address string `form:"addressOrder"  search:"type:order;column:address;table:population"`
    City string `form:"cityOrder"  search:"type:order;column:city;table:population"`
    Country string `form:"countryOrder"  search:"type:order;column:country;table:population"`
    Nationality string `form:"nationalityOrder"  search:"type:order;column:nationality;table:population"`
    MaritalStatus string `form:"maritalStatusOrder"  search:"type:order;column:marital_status;table:population"`
    EducationLevel string `form:"educationLevelOrder"  search:"type:order;column:education_level;table:population"`
    Income string `form:"incomeOrder"  search:"type:order;column:income;table:population"`
    FamilySize string `form:"familySizeOrder"  search:"type:order;column:family_size;table:population"`
    
}

func (m *PopulationGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type PopulationInsertReq struct {
    Id int `json:"-" comment:"主键，自增ID"` // 主键，自增ID
    Name string `json:"name" comment:"姓名"`
    Age string `json:"age" comment:"年龄"`
    Gender string `json:"gender" comment:"性别"`
    Occupation string `json:"occupation" comment:"职业"`
    Address string `json:"address" comment:"地址"`
    City string `json:"city" comment:"城市"`
    Country string `json:"country" comment:"国家"`
    Nationality string `json:"nationality" comment:"国籍"`
    MaritalStatus string `json:"maritalStatus" comment:"婚姻状况"`
    EducationLevel string `json:"educationLevel" comment:"教育水平"`
    Income string `json:"income" comment:"收入"`
    FamilySize string `json:"familySize" comment:"家庭规模"`
    common.ControlBy
}

func (s *PopulationInsertReq) Generate(model *models.Population)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
    model.Name = s.Name
    model.Age = s.Age
    model.Gender = s.Gender
    model.Occupation = s.Occupation
    model.Address = s.Address
    model.City = s.City
    model.Country = s.Country
    model.Nationality = s.Nationality
    model.MaritalStatus = s.MaritalStatus
    model.EducationLevel = s.EducationLevel
    model.Income = s.Income
    model.FamilySize = s.FamilySize
}

func (s *PopulationInsertReq) GetId() interface{} {
	return s.Id
}

type PopulationUpdateReq struct {
    Id int `uri:"id" comment:"主键，自增ID"` // 主键，自增ID
    Name string `json:"name" comment:"姓名"`
    Age string `json:"age" comment:"年龄"`
    Gender string `json:"gender" comment:"性别"`
    Occupation string `json:"occupation" comment:"职业"`
    Address string `json:"address" comment:"地址"`
    City string `json:"city" comment:"城市"`
    Country string `json:"country" comment:"国家"`
    Nationality string `json:"nationality" comment:"国籍"`
    MaritalStatus string `json:"maritalStatus" comment:"婚姻状况"`
    EducationLevel string `json:"educationLevel" comment:"教育水平"`
    Income string `json:"income" comment:"收入"`
    FamilySize string `json:"familySize" comment:"家庭规模"`
    common.ControlBy
}

func (s *PopulationUpdateReq) Generate(model *models.Population)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
    model.Name = s.Name
    model.Age = s.Age
    model.Gender = s.Gender
    model.Occupation = s.Occupation
    model.Address = s.Address
    model.City = s.City
    model.Country = s.Country
    model.Nationality = s.Nationality
    model.MaritalStatus = s.MaritalStatus
    model.EducationLevel = s.EducationLevel
    model.Income = s.Income
    model.FamilySize = s.FamilySize
}

func (s *PopulationUpdateReq) GetId() interface{} {
	return s.Id
}

// PopulationGetReq 功能获取请求参数
type PopulationGetReq struct {
     Id int `uri:"id"`
}
func (s *PopulationGetReq) GetId() interface{} {
	return s.Id
}

// PopulationDeleteReq 功能删除请求参数
type PopulationDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *PopulationDeleteReq) GetId() interface{} {
	return s.Ids
}
